﻿using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Missbot.AIModule.Schedulers.DailyVtuber;
using Missbot.Common;

namespace Missbot.Admin.Controllers
{
    [Route("[controller]/[action]")]
    public class VtuberController : APIBaseController
    {
        private static VtuberPicSvc VtuberPicSvc => AutofacSvc.Resolve<VtuberPicSvc>();
        
        [HttpPost]
        public IActionResult InsertVtuberPics(InsertVtuberPicsReq[] models)
        {
            var success = models.Count(model => VtuberPicSvc.PicUpload(model.Name, model.Url));
            return new JsonResult(new {code = 1, success, total = models.Length});
        }
        
        public class InsertVtuberPicsReq
        {
            public string Url { get; set; }
            
            public string Name { get; set; }
        }
    }
}